#include <stdio.h>
#include <stdlib.h>

void swap(int *x,int *y)
{
    *x ^= *y;
    *y ^= *x;
    *x ^= *y;
}

int getmax(int y[],int x)
{
    int max = y[0];
    for (int i = 0; i < 5; i++)
    {
        if(max<y[i])max = y[i];
    }
    return max;
}

void oushu_1(int x[],int y)
{
    for(int i=0;i<y;i++)
    {
        if(x[i]%2==0)
        {
            x[i] -= 1;
        }
    }
}

void BubbleSort(int x[],int y)
{
    for (int i = 0; i < y; i++)
    {
        for (int j = 0; j < 4-i; j++)
        {
            if ( x[j] > x[j+1])
            {
                x[j] ^= x[j+1];
                x[j+1] ^= x[j];
                x[j] ^= x[j+1];
            }
        }
    }
}

int main(int argc, char const *argv[])
{
    int a = 10;
    int b = 20;
    swap(&a,&b);
    printf("a的值是%d,b的值是%d\n",a,b);

    int num[5] = {5,3,8,2,9};
    printf("max的值是%d\n",getmax(num,sizeof(num)/sizeof(num[0])));

    int num_1[10] = {1,2,3,4,5,6,7,8,9,10};
    oushu_1(num_1,sizeof(num_1)/sizeof(num_1[0]));
    for (int i = 0; i < 10; i++)
    {
        printf("%d ",num_1[i]);
    }
    printf("\n");

//  int num_2[1][5] = {4,7,2,8,3};
//  int (*p) [5] = {4,7,2,8,3};
    int num_2[5] = {4,7,2,8,3};
    //  num_2[1] = 7;
    BubbleSort(num_2,sizeof(num_2)/sizeof(num_2[0]));
    for (int i = 0; i < 5; i++)
    {
        printf("%d ",num_2[i]);
    }
    printf("\n");

    return 0;
}
